import 'package:flutter/foundation.dart';
import 'package:test_app/core/base/base/base_logic.dart';
import 'package:test_app/routers/main/main_navigator.dart';
import 'package:test_app/routers/home/home_navigator.dart';
import 'package:test_app/core/utils/storage/storage_util.dart';
import 'details_state.dart';

class DetailsController extends BaseLogic {

  final DetailsState detailsState = DetailsState();

  @override
  void initData() {
    super.initData();
    debugPrint('DetailsController init');
    init();
  }

  init() {
    detailsState.title = '12';
  }

  toMy() {
    MainNavigator.toMy();
  }

  void setUserInfo() {
    StorageUtil.setObject('userInfo',{ "userId": 1008, "nickName": 'xie' });
  }

  // 传递参数 接受返回值
  toOrder() async {
    final res = await HomeNavigator.toOrder({'id': 1, 'a': 'aaa'});
    if (res is String) {
      detailsState.orderStr.value = res;
    }
    debugPrint('Order result => $res');
  }


}
